package com.liangzdemo;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

import com.liangzdemo.SerialPort.Main5Activity;
import com.liangzdemo.binder.BinderActivity;
import com.liangzdemo.book.BookManagerActivity;
import com.liangzdemo.network.Main4Activity;
import com.liangzdemo.observer.Main2Activity;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    private Button mButton;
    private Button mButton2;
    private Button mButton3;
    private Button mButton4;
    private Button mButton5;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
    }

    private void initView() {
        mButton = (Button)findViewById(R.id.button1);
        mButton.setOnClickListener(this);

        mButton2 = (Button)findViewById(R.id.button2);
        mButton2.setOnClickListener(this);

        mButton3 = (Button)findViewById(R.id.button3);
        mButton3.setOnClickListener(this);

        mButton4 = (Button)findViewById(R.id.button4);
        mButton4.setOnClickListener(this);

        mButton5 = (Button)findViewById(R.id.button5);
        mButton5.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.button1:
                startActivity(new Intent(this, BinderActivity.class));
                break;

            case R.id.button2:
                startActivity(new Intent(this, BookManagerActivity.class));
                break;

            case R.id.button3:
                startActivity(new Intent(this, Main2Activity.class));
                break;
            case R.id.button4:
                startActivity(new Intent(this, Main4Activity.class));
                break;

            case R.id.button5:
                startActivity(new Intent(this, Main5Activity.class));
                break;
        }
    }
}
